package com.example.demo.controller;

import com.example.demo.model.Nutritionalvalue;
import com.example.demo.service.NutritionalValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NutritionalValueController {
    private NutritionalValueService nutritionalValueService;

    @Autowired
    public NutritionalValueController(NutritionalValueService nutritionalValueService) {
        this.nutritionalValueService = nutritionalValueService;
    }

    @GetMapping("/dishes/{name}/nutritionalvalue")
    public Nutritionalvalue getDishNutritionalValue(@PathVariable String name) {
        return nutritionalValueService.getDishNutritionalValue(name);
    }

    @GetMapping("/ingredient/{name}/nutritionalvalue")
    public Nutritionalvalue getIngredientNutritionalValue(@PathVariable String name) {
        return nutritionalValueService.getIngredientNutritionalValue(name);
    }
}
